/*
 * Copyright (c) 2016 zhangcm. All Rights Reserved.
 */
package com.jnzc.ocr.serv.shop.api.impl;

import com.google.common.collect.Maps;
import com.jnzc.ocr.common.bean.PageResult;
import com.jnzc.ocr.common.utils.ValidateUtils;
import com.jnzc.ocr.serv.shop.api.ShopMarketingPlanApi;
import com.jnzc.ocr.serv.shop.entity.ShopMarketingPlan;
import com.jnzc.ocr.serv.shop.entity.ShopMarketingPlan;
import com.jnzc.ocr.serv.shop.filter.ShopMarketingPlanFilter;
import com.jnzc.ocr.serv.shop.service.ShopMarketingPlanService;
import com.jnzc.ocr.serv.shop.vo.ShopMarketingPlanSelectResultVo;
import com.jnzc.ocr.serv.shop.vo.ShopMarketingPlanSelectVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author zhangcm
 * @version 1.0, 2017/9/13
 */
@RestController
public class ShopMarketingPlanApiImpl implements ShopMarketingPlanApi {

    @Autowired
    private ShopMarketingPlanService shopMarketingPlanService;

    @Override
    public ShopMarketingPlan find(@RequestParam("id") Long id, @RequestParam("shopId") Long shopId) {
        return shopMarketingPlanService.find(id, shopId);
    }

    @Override
    public PageResult<ShopMarketingPlan> search(@RequestBody ShopMarketingPlanFilter filter, @RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize) {
        return shopMarketingPlanService.search(filter, pageNo, pageSize);
    }

    @Override
    public ShopMarketingPlan save(@RequestBody ShopMarketingPlan obj) {
        return shopMarketingPlanService.save(obj);
    }

    @Override
    public void delete(@RequestParam("id") Long id, @RequestParam("shopId") Long shopId) {
        ShopMarketingPlan obj = find(id, shopId);
        shopMarketingPlanService.delete(id);
    }

    @Override
    public Map<String, ShopMarketingPlanSelectResultVo> selectPlan(@RequestBody ShopMarketingPlanSelectVo selectVo, Long shopId) {
        return shopMarketingPlanService.selectPlan(selectVo, shopId);
    }
}
